,
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  var arr = [3, 48, 66, 71, 99, 101, 120, 151, 188, 209]

  function searchArr(target) {
    var start = 0,
      end = arr.length - 1,
      mid, ele
    while (start <= end) {
      mid = Math.floor((start + end) / 2)
      ele = arr[mid]
      if (target === ele) {
        return mid
      } else if (target < ele) {
        end = end - 1
      } else {
        start = start + 1
      }
      return -1
    }
  }
</script>

</html>